#!/bin/bash

# README!!!

#First compile SRILM as follows:

#In srilm/common/Makefile.machine.i686 (also for x86_64!) set:
# ADDITIONAL_CFLAGS =-fPIC
# ADDITIONAL_CXXFLAGS =-fPIC

#And change GCC_FLAGS to GCC_FLAGS =  -Wreturn-type -Wimplicit

#Then compile:
# make MACHINE_TYPE=i686 NO_TCL=X

#Then edit the directories in this script and run ./makesrilm

if [ -z $1 ]; then
	echo "Usage: ./makesrilm /path/to/srilm/ [pythonversion]" >&2
	exit 1;
fi



export SRILM=$1   #Default: /home/mvgompel/tmp/srilm5.10/ #(must be an absolute path!)
export SRILMLIBS=$SRILM/lib/i686
if [ -z $1 ]; then
    PYTHONVERSION=$2
else
    PYTHONVERSION="2.7"
fi
g++ -fPIC -shared -I/usr/include/python$PYTHONVERSION -lpython$PYTHONVERSION -I$SRILM/src -I$SRILM/include -lboost_python srilm.cc $SRILMLIBS/liboolm.a $SRILMLIBS/libdstruct.a $SRILMLIBS/libmisc.a -o srilmcc.so

